Ext.ns("sh.mytool.cv.module");

sh.mytool.cv.module.ImageGalleryPanel = Ext.extend(Ext.Panel, {
    pageSize: 12,
    queryGalleryUrl: "",
    queryImageUrl: "",
    getGalleryUrl: "",
    getImageUrl: "",
    editGalleryUrl: "",
    editImageUrl: "",
    removeGalleryUrl: "",
    removeImageUrl: "",
    imageRoot: "",
    imageCoverRoot: "",
    layout: {type: 'hbox', align: 'stretch'},
    power: "",
    initComponent : function() {
        sh.mytool.cv.module.ImageGalleryPanel.superclass.initComponent.call(this);
        this.galleryPanel = new sh.mytool.cv.module.GalleryPanel({
            flex: 1,
            border: false,
            pageSize: this.pageSize,
            queryUrl: this.queryGalleryUrl,
            getUrl: this.getGalleryUrl,
            editUrl: this.editGalleryUrl,
            removeUrl: this.removeGalleryUrl,
            imageRoot: this.imageCoverRoot,
            power: this.power
        });
        this.galleryPanel.dataView.on("dblclick", function(view, index, node, e) {
            var galleryId = this.galleryPanel.getSelectData().id;
            this.imagePanel = new sh.mytool.cv.module.ImagePanel({
                flex: 1,
                border: false,
                pageSize: this.pageSize,
                galleryPanel: this.galleryPanel,
                queryUrl: this.queryImageUrl + "?galleryId=" + galleryId,
                getUrl: this.getImageUrl + "?galleryId=" + galleryId,
                editUrl: this.editImageUrl + "?galleryId=" + galleryId,
                removeUrl: this.removeImageUrl + "?galleryId=" + galleryId,
                imageRoot: this.imageRoot,
                power: this.power
            });
            this.galleryPanel.hide();
            this.add(this.imagePanel);
            this.doLayout();
        }, this);
        this.add(this.galleryPanel);
    }
});
